<?php
namespace Admin\Controller;
use Think\Controller;
use Admin\Common\Logic;
class LoginController extends Controller {

  private $Logic   = null;
 public function  _initialize(){
    $this->Logic = new Logic();
 }

    public function index(){
     $this->display('login');
  }

  public function check_login(){
       $data = $_POST;
       if(empty($data)){
        $this->ajaxreturn(array('state'=>0,'msg'=>'信息传递错误'));
       }
      $id =  $this->Logic->check_login($data);
        if(empty($id) && $id <= 0){

           $this->ajaxreturn(array('state'=>0,'msg'=>'用户名或者密码错误'));
        }
    $this->ajaxreturn(array('state'=>1,'msg'=>'验证成功'));
  }



  public function logout(){
    session('admin_user',null);
    $this->redirect('Login/index');
  }
}
